import { qsStringify } from "./../utils/common";
import request from '@/utils/request'
// import qs from 'qs'

// 使用枚举包含所有的path
enum Api {
  selectAddSet = '/user/select/addSet',
  editAddSet = '/user/edit/addSet',
  editAutoSetData = '/user/edit/addAutoSetData',
  editManualSetData = '/user/edit/addManualSetData'
}



// 查询设备的附加设置的Api
export const selectAddSetApi = (devGId: number) => {
  // let data = qsStringify({ devId: devId })
  return request.post(Api.selectAddSet + `?devGId=${ devGId }`)
}


// 自动模式与手动模式切换的Api
export const editAddSetApi = (data: { addSetId: number, nowStatus: number }) => {
  // let dataS = qsStringify(data)
  return request.post(Api.editAddSet + `?addSetId=${ data.addSetId }&nowStatus=${ data.nowStatus }`)
}


// 修改自动设置数据的Api
export const editAutoSetDataApi = (data: { setDataId: number, autoCollectRate: number, limitValue: number | string }) => {
  let dataS = qsStringify(data)
  return request.post(Api.editAutoSetData + `?setDataId=${ data.setDataId }&autoCollectRate=${ data.autoCollectRate }&limitValue=${ data.limitValue }`)
}



// 修改手动设置数据
export const editManualSetDataApi = (data: { setDataId: number, autoCollectRate: number }) => {
  // let dataS = qsStringify(data)
  return request.post(Api.editManualSetData + `?setDataId=${ data.setDataId }&autoCollectRate=${ data.autoCollectRate }`)
}

